/**
* Copyright (C)2001-2099 Zeai.cn All rights reserved.
* E-Mail：supdes#qq.com　QQ:797311
* http://www.a9a.cn
* http://www.zeai.cn
* http://www.yzlove.com
* Last update 2022/11/20 by supdes
*/
var index_divclose;
/*Marquee*/
var zeai_iMarquee = function (id, tag, heigh, speed, delay) {
	var me = this;
	me.EL = document.getElementById(id);
	me.PA = 0;
	me.TI = null;
	me.LH = heigh;
	me.SP = speed;
	me.DY = delay;
	me.exec = function () {
		if (me.PA) return;
		me.EL.scrollTop += 2;
		if (me.EL.scrollTop % me.LH <= 1) {
			clearInterval(me.TI);
			me.EL.appendChild(me.EL.getElementsByTagName(tag)[0]);
			me.EL.scrollTop = 0;
			setTimeout(me.start, me.DY * 1000);
		}
	};
	me.start = function () {if (me.EL.scrollHeight - me.EL.offsetHeight >= me.LH) me.TI = setInterval(me.exec, me.SP);};
	//me.EL.onmouseover = function () { me.PA = 1 };
	//me.EL.onmouseout = function () { me.PA = 0 };
	setTimeout(me.start, me.DY * 1000);
};
function zeai_iMarqueeFn(){
	zeai.ajax({url:MHOST+'/index'+zeai.ajxext+'submitok=ajax_iMarquee'},function(e){
		if(!zeai.empty(e)){
			iMarquee.html(e);
			setTimeout(function(){new zeai_iMarquee("iMarquee","li",30,20,1.5);},100);
		}
	});
}
function iMarqueeBox_off(that){
	var f=that.parentNode;f=f.parentNode;
	f.parentNode.removeChild(f);
}
function LRmoveFn(obj,n,jj) {
	if (n == 0) {
		return false;
	} else {
		if(jj==1){
			obj.scrollLeft = obj.scrollLeft+2;
		}else{
			obj.scrollLeft = obj.scrollLeft-2;
		}
		n--;
	} 
	cleandsj=setTimeout(function(){LRmoveFn(obj,n,jj)},10);
}
function gpsbtnFn(cook_longitude,cook_latitude,cook_areatitle){
	var jurl=MHOST+'/user'+zeai.ajxext+'t=gps';
	zeai.ajax({url:MHOST+'/index'+zeai.ajxext+'submitok=ajax_gps',js:1},function(e){var rs=zeai.jsoneval(e);
		if(rs.flag==1){
			zeai.openurl(jurl);
		}else{
			if(browser=='wx'){
				wx.getLocation({
					type: 'wgs84',
					success: function (res) {
						var latitude = res.latitude,longitude= res.longitude;
						zeai.ajax({url:MHOST+'/index'+zeai.extname,js:1,data:{submitok:'ajax_gps_save',latitude:latitude,longitude:longitude}},function(e){var rs=zeai.jsoneval(e);
							if(rs.flag==1){
								zeai.openurl(jurl);	
							}else{
								//zeai.alert('您已拒绝授权定位，将无法使用附近的人');
								setmap(showtype,cook_longitude,cook_latitude,cook_areatitle);
							}
						});
					},
					cancel: function (res) {zeai.alert('您已拒绝授权定位，将无法使用附近的人');},
					fail: function (res) {
						//zeai.msg('请开启手机本身的GPS定位后并同意授权',{time:4});
						setmap(showtype,cook_longitude,cook_latitude,cook_areatitle);
					}
				});
			}else if(browser=='app'){
				plus.geolocation.getCurrentPosition(function(p){
					zeai.ajax({url:MHOST+'/index'+zeai.extname,js:1,data:{submitok:'ajax_gps_save',latitude:p.coords.latitude,longitude:p.coords.longitude}},function(e){var rs=zeai.jsoneval(e);
						if(rs.flag==1){zeai.openurl(jurl);}else{
							//zeai.msg('定位失败:' + rs.msg,{time:4});
							setmap(showtype,cook_longitude,cook_latitude,cook_areatitle);
						}
					});	
				}, function(e){
					//zeai.msg('获取定位失败:' + e.message,{time:4});
					setmap(showtype,cook_longitude,cook_latitude,cook_areatitle);
				});
			}else{
				//zeai.msg('请使用微信打开并同意获取自己的定位',{time:4});
				setmap(showtype,cook_longitude,cook_latitude,cook_areatitle);
			}
		}
	});
	function setmap(showtype,cook_longitude,cook_latitude,cook_areatitle){zeai.openurl(MHOST+'/map_set.php?kind=u&showtype='+showtype+'&longitude='+cook_longitude+'&latitude='+cook_latitude+'&areatitle='+cook_areatitle);}
}

function logoFn(){
	if(!logo.hasClass('ed')){
		logobox.show();
		logo.addClass('ed');
		zeai.mask({son:o('logobox'),close:function(){logo.removeClass('ed');}    });
	}else{
		logobox.hide();
		logo.removeClass('ed');
		o('Mlogobox').click();
	}
}